//
//  LBReactError.h
//  LBReact
//
//  Created by WuShiHai on 19/6/19.
//  Copyright (c) 2019 Lebbay. All rights reserved.
//

FOUNDATION_EXPORT NSErrorDomain const LBReactBridgeErrorDomain;

FOUNDATION_EXPORT NSString *const LBReactBridgeRenderUnKownErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderLoadingErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderOperationFolderErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderBundleNotFoundErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderNetwokErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderServerFormatErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderServerErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderModuleNotFoundErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderDownloaderErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderDataBaseSaveErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderLevelUnKownErrorMessage;
FOUNDATION_EXPORT NSString *const LBReactBridgeRenderReadFileErrorMessage;

typedef NS_ENUM(NSUInteger, LBReactBridgeRenderErrorType) {
    LBReactBridgeRenderUnKownErrorType = 0, //未知错误
    LBReactBridgeRenderLoadingErrorType = 1, //加载错误
    LBReactBridgeRenderOperationFolderErrorType = 2, //文件夹操作失败
    LBReactBridgeRenderBundleNotFoundErrorType = 3, //资源文件本地文件夹中未发现
    LBReactBridgeRenderNetwokErrorType = 4, //因为网络导致的下载失败
    LBReactBridgeRenderServerFormatErrorType = 5, //服务端返回的数据格式不正确
    LBReactBridgeRenderServerErrorType = 6, //服务端返回失败
    LBReactBridgeRenderModuleNotFoundErrorType = 7, //接口请求未发现该模块的补丁包
    LBReactBridgeRenderDownloaderErrorType = 8, //补丁包下载失败
    LBReactBridgeRenderDataBaseSaveErrorType = 9, //数据库保存该补丁包失败
    LBReactBridgeRenderLevelUnKownErrorType = 10, //策略等级未知
    LBReactBridgeRenderReadFileErrorType = 11, //读取文件数据流错误
};

#ifndef LBReactBridgeRenderError
#define LBReactBridgeRenderError(theme) \
    [NSError errorWithDomain:LBReactBridgeErrorDomain \
                        code:LBReactBridgeRender##theme##ErrorType   \
                    userInfo:@{ \
                               @"message": LBReactBridgeRender##theme##ErrorMessage  \
                            }]
#endif
